//! 身份认证与权限相关的核心数据结构

use serde::{Deserialize, Serialize};

/// 系统用户
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct User {
    /// 用户名
    pub username: String,
    /// 密码 (通常存储的是哈希值)
    pub password_hash: String,
    /// 关联的角色列表
    pub roles: Vec<String>,
    /// 是否启用
    pub enabled: bool,
}

/// 系统角色
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Role {
    /// 角色名 (唯一)
    pub name: String,
    /// 关联的权限列表
    pub permissions: Vec<Permission>,
}

/// 权限定义
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Permission {
    /// 资源类型 (e.g., "config", "service")
    pub resource: String,
    /// 作用域 (e.g., a specific namespace or group)
    pub scope: String,
    /// 操作 (e.g., "read", "write", "delete")
    pub action: String,
}
